<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改社工')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-worker-edit" th:object="${jiajiaWorker}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-8">
                    <input name="name" th:field="*{name}" class="form-control" type="text">
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-3 control-label">年龄：</label>
                <div class="col-sm-8">
                    <input name="age" th:field="*{age}" class="form-control" type="text">
                </div>
            </div>



            <div class="form-group">    
                <label class="col-sm-3 control-label">头像：</label>
<!--                <div class="col-sm-8">-->
<!--                    <input name="avatar" th:field="*{avatar}" class="form-control" type="text">-->
<!--                </div>-->
                <div class="col-sm-8">
                    <input id="avatarFile" accept="image/jpg,image/jpeg,image/png" name="file"  class="form-control" type="file">
                    <img style="width: 80px ;height: auto;"  th:src="*{avatar}" id="avatarImg"  />
                    <input style="display: none" id="avatar" name="avatar" class="form-control" th:value="*{avatar}"   type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">正面照：</label>
                <div class="col-sm-8">
                    <input id="artAvatarFile" accept="image/jpg,image/jpeg,image/png" name="file"  class="form-control" type="file">
                    <img style="width: 80px ;height: auto;"  th:src="*{artAvatar}" id="artAvatarImg"  />
                    <input style="display: none" id="artAvatar" name="artAvatar" class="form-control" th:value="*{artAvatar}"  type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态 0 已休息 1 可服务：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <input type="radio" name="status" th:value="*{status}">
                        <label th:for="status" th:text="未知"></label>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">户籍所在地：</label>
                <div class="col-sm-8">
                    <input name="registeredResidence" th:field="*{registeredResidence}" class="form-control" type="text">
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-3 control-label">职业认定：</label>
                <div class="col-sm-8">
                    <input name="professionalCertification" th:field="*{professionalCertification}" class="form-control" type="text">
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-3 control-label">个人描述：</label>
                <div class="col-sm-8">
                    <textarea name="des" class="form-control">[[*{des}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">评分：</label>
                <div class="col-sm-8">
                    <input name="score" th:field="*{score}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">服务数量：</label>
                <div class="col-sm-8">
                    <input name="num" th:field="*{num}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">添加时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="addtime" th:value="${#dates.format(jiajiaWorker.addtime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">性别 1男 2女：</label>
                <div class="col-sm-8">
                    <select name="sex" class="form-control m-b">
                        <option value="1">男</option>
                        <option value="2">女</option>
                    </select>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">身份1已认证 2未认证：</label>
                <div class="col-sm-8">
                    <input name="codeAuth" th:field="*{codeAuth}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">纬度：</label>
                <div class="col-sm-8">
                    <input name="lat" th:field="*{lat}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">经度：</label>
                <div class="col-sm-8">
                    <input name="lng" th:field="*{lng}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">单位KM：</label>
                <div class="col-sm-8">
                    <input name="scope" th:field="*{scope}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:src="@{/js/bootstrap-prettyfile.js}"></script>
    <script th:inline="javascript">
        var prefix = ctx + "jiajia/worker";
        $("#form-worker-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var formData = new FormData();
                formData.append('avatarFile', $("#avatarFile")[0].files[0]);
                formData.append('artAvatarFile', $("#artAvatarFile")[0].files[0]);
                $.modal.loading("图片上传中，请稍后...")
                $.ajax({
                    url: "/common/admin/upload/up/more",
                    data: formData,
                    type: "post",
                    dataType: "json",
                    processData: false,
                    contentType: false,
                    success: function(result) {
                        $("#avatar").val(result.avatarFile_url);
                        $("#artAvatar").val(result.artAvatarFile_url);
                        $.operate.save(prefix + "/edit", $('#form-worker-edit').serialize());
                    }
                })
            }
        }

        $("input[name='addtime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>